package edu.sctu.zhengsenwen.month201506.day20150611.Array;

/**
 * Created by user15 on 2015/6/12.
 */
public class C04E02 {

    public static void main(String[] args) {

        int[] grades = {69,79,93,83,70,89};

        System.out.println("Before:");
        for(int i = 0;i < 6;i++){

            System.out.print(grades[i] + "\t");


        }
        System.out.println();
        System.out.println("Reserve:");
            reserve(grades);
            for(int i = 0;i<6;i++){

                System.out.print(grades[i]+"\t");
            }

    }

    private static void reserve(int[] grades) {

        int i= 0;
        int j = grades.length-1;
        while(i<j){

            int instead = grades[i];
            grades[i] = grades[j];
            grades[j] = instead;
            i++;
            j--;
        }
    }


}


